home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 October / Chip Ekim 2003.iso / prog / code / contr / setup.exe / Disk1 / data1.cab / Configuration_En / Objects / Media / Flash.js < prev   
Encoding:
JavaScript  |  2003-07-18  |  3.5 KB  |  128 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2. function isDOMRequired() { 
  3.   // return true.  This will insert the object into the design view.
  4.   return true;
  5. }
  6.  
  7. function isAsset() {
  8.     return true;
  9. }
  10.  
  11. function objectTag(assetArgs)
  12. {
  13.     var bDialogState = dw.getShowDialogsOnInsert();
  14.  
  15.     // Return the html tag that should be inserted
  16.  
  17.     var theMovie = '';
  18.  
  19.     if (dw.appName == "Contribute")
  20.     {
  21.         var filter = new Array(dw.loadString("insert doc dialog/flash doc desc") + " (*.swf)|*.swf|");
  22.         if (MM.InsertFlashType == 'file')
  23.             theMovie = dw.browseForFileURL("open", "", false, "", filter, "", "", "desktop");
  24.         else
  25.             theMovie = dw.browseForFlashOnWebsite ();
  26.  
  27.         if (theMovie != null && theMovie != '') {
  28.  
  29.             // warn if the filename contains double-byte characters
  30.             var nameStr = getFileName(theMovie);
  31.             var isDoubleByteFileName = false;
  32.  
  33.             for (i=0; i<nameStr.length; i++) {
  34.                 theChar = ""+nameStr.charAt(i); //get char, convert to string
  35.                 if (theChar.charCodeAt(0) > 255 && i<nameStr.length-1) {
  36.                     isDoubleByteFileName = true;
  37.                     i = nameStr.length;                                    // break        
  38.                 }
  39.             }
  40.  
  41.             if (isDoubleByteFileName)
  42.             {
  43.                 var alertString = dw.loadString ("file naming/doublebyte filename warning");
  44.                 var cmdName = 'ccAlert.htm';
  45.                 var cmdFile = dreamweaver.getConfigurationPath() + '/Commands/' + cmdName;
  46.                 var cmdDOM = dreamweaver.getDocumentDOM(cmdFile);
  47.  
  48.                 if (cmdDOM) {
  49.                     var cmdWin = cmdDOM.parentWindow;
  50.                     // Pass one arg for OK/Cancel, or extra args to define btns
  51.                     cmdWin.render(alertString, MM.BTN_Yes, MM.BTN_No);
  52.     
  53.                     dreamweaver.popupCommand(cmdName);
  54.                     if (MMNotes.Confirm_RESULT == MM.BTN_No)
  55.                         return ''; 
  56.                   }
  57.             }
  58.  
  59.             var prefsAccessibilityOption = dw.getAdminEnforceAccessibilityPref();
  60.             if (prefsAccessibilityOption)
  61.             {
  62.                 var ok = dw.displayOptionalDialog("Flash Accessibility Warning Dialog", 
  63.                                                 dw.loadString("insert doc dialog/flash accessibility warning"), 
  64.                                                 true);
  65.                 if (!ok)
  66.                 {
  67.                     return '';
  68.                 }
  69.             }
  70.  
  71.         } // cancel dialog
  72.  
  73.     }
  74.     else
  75.     {
  76.         theMovie = dw.browseForFileURL();
  77.     }
  78.     
  79.     if (theMovie != '')
  80.     {
  81.         theMovie = dw.doURLEncoding(theMovie);
  82.     }
  83.  
  84.     if (assetArgs)
  85.     {
  86.         theMovie = assetArgs;
  87.     }
  88.  
  89.     if ((theMovie == '') && bDialogState)
  90.     {
  91.         return '';
  92.     }
  93.  
  94.     rtnStr = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + 
  95.                 ' CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" WIDTH="32" HEIGHT="32">\n' + 
  96.                 '<PARAM NAME="movie" VALUE="' + theMovie + '"> <PARAM NAME="quality" VALUE="high">\n' +
  97.                 '<EMBED SRC="' + theMovie +
  98.                 '" quality="high" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ' +
  99.                 'TYPE="application/x-shockwave-flash" WIDTH="32" HEIGHT="32">'+
  100.                 '</EMBED></OBJECT>';
  101.  
  102.     prefsAccessibilityOption = dw.getPreferenceString("Accessibility", "Accessibility Media Options", "");
  103.  
  104.     if (prefsAccessibilityOption == 'TRUE')
  105.     {
  106.         rtnStr = addAccessibility(rtnStr);
  107.     }
  108.  
  109.     return rtnStr;
  110. }
  111.  
  112.  
  113. function addAccessibility(rtnStr) {
  114.    var cmdFile = dreamweaver.getConfigurationPath() + "/Commands/Object Options.htm";
  115.    var cmdDOM = dreamweaver.getDocumentDOM(cmdFile);
  116.  
  117.    cmdDOM.parentWindow.setFormItem(rtnStr);
  118.    dreamweaver.popupCommand("Object Options.htm");
  119.    return (cmdDOM.parentWindow.returnAccessibilityStr(rtnStr));    
  120. }
  121.  
  122. function getFileName(url) {
  123.   var index = url.lastIndexOf('/');
  124.   if (index != -1) retVal = url.substring(index + 1);
  125.   else retVal = url;
  126.   return retVal;
  127. }
  128.